package com.yz.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author yuanzheng
 * @date 2020/7/25-21:57
 */
@RestController
public class JdbcController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @RequestMapping("/list")
    public List<Map<String,Object>> getList(){
        String sql = "select * from books";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}
